<%@ page import="domain.Product" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.LinkedHashMap" %>
<%@ page import="java.util.Collection" %><%--
  Created by IntelliJ IDEA.
  User: 86147
  Date: 2024/4/7
  Time: 20:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<html>
<head>
    <title>商品展示列表</title>
</head>
<body>
<!--1.网上书城顶部start-->
<%@include file="include/head.jsp"%>
<!--网上书城顶部 end-->
<!--2.网上书城菜单列表 start-->
<%@include file="include/menu_search.jsp"%>
<!--网上书城菜单列表end-->
<br>
<!--3.网上书城商品目录 start-->
<%--<%
    Map<String,Product> product=new LinkedHashMap<String,Product>();
    product.put("1",new Product("1","网管员必备宝典",20,30,"images/productImg/image1.jpg"));
    product.put("2",new Product("2","Java基础入门",45,20,"images/productImg/image2.png"));
    product.put("3",new Product("3","学会宽容",25,15,"images/productImg/image3.jpg"));
    product.put("4",new Product("4","杜拉拉升职记",54,25,"images/productImg/image4.jpg"));
%>
<%     Collection<Product> allProducts= product.values();
    session.setAttribute("products",allProducts);
%>

<table align="center" style="background: ivory">
    <tr><td style="size: B5"><b>商品目录</b></td></tr>
    <tr ><td style="padding-left: 20px">共4种商品</td></tr>
    </tr>
    <tr>
        <% for(Product pro:allProducts)
        {
        %>
        <td>
            <br>
            <div>
                    <img src="<%=pro.getImgurl()%>" width="115" height="129" border="0" />
            </div>
            <div>
                <form action="Handle-AddCart.jsp?pId=<%=pro.getId()%>"	method="post">
                    书名：<br><input type="text"	style="border:none;"		name="PName" value=<%=pro.getName()%>><br />
                    售价：<br><input type="text"	style="border:none;"		name="Price" value=￥<%=pro.getPrice()%>> <br />
                    库存：<br><input type="text"		style="border:none;"	name="PNum" value=<%=pro.getPnum()%>><br />
                    <input type="submit"  name="book"	value="购买"	>
                </form>
            </div>
        </td>
        <%}%>
    </tr>
</table>--%>
<table align="center" style="background: ivory" width="70%" heighth="90%">
    <tr><td style="size: B5"><b>商品目录</b></td></tr>
    <c:forEach items="${ProductList}" var="p">
        <tr>
            <td>
                <div>
                    <img src="${p.imgurl}" width="115" height="129" />
                </div>
                <div>
                    <form action="Handle-AddCart.jsp?pId=${p.id}" method="post">
                        <span style="border:none;">书名：${p.name}</span><br />
                        <span style="border:none;">售价：￥${p.price}</span><br />
                        <span style="border:none;">库存：${p.pnum}</span><br />
                        <input type="submit" name="book" value="购买" />
                    </form>
                </div>
            </td>
        </tr>
    </c:forEach>
</table>
<!--网上书城商品目录end-->
<br>
<!--4.网上书城下方显示 start-->
<%@include file="include/foot.jsp"%>
<!--网上书城下方显示end-->
</body>
</html>
